package com.fr.report.script.function;

import com.fr.base.core.ComparatorUtils;
import com.fr.report.script.Function;
import com.fr.report.script.Function.Type;
import com.fr.report.script.NormalFunction;
import com.fr.report.script.Primitive;

public class EXACT extends NormalFunction
{
  public Object run(Object[] paramArrayOfObject)
  {
    if (paramArrayOfObject.length < 2)
      return Primitive.ERROR_NAME;
    return new Boolean(ComparatorUtils.equals(paramArrayOfObject[0], paramArrayOfObject[1]));
  }

  public Function.Type getType()
  {
    return Function.TEXT;
  }

  public String getCN()
  {
    return "EXACT(text1,text2): 检测两组文本是否相同。如果完全相同，EXACT函数返回TRUE；否则，返回FALSE。EXACT函数可以区分大小写，但忽略格式的不同。同时也可以利用EXACT函数来检测输入文档的文字。\nText1:需要比较的第一组文本。\nText2:需要比较的第二组文本。\n示例:\nEXACT(\"Spreadsheet\",\"Spreadsheet\")等于TRUE。\nEXACT(\"Spreadsheet\",\"S preadsheet\")等于FALSE。\nEXACT(\"Spreadsheet\",\"spreadsheet\")等于FALSE。";
  }

  public String getEN()
  {
    return "EXACT(text1,text2): Compares two text strings and returns TRUE if they are exactly the same, FALSE otherwise. EXACT is case-sensitive but ignores formatting differences. Use EXACT to test text being entered into a document.\nText1 is the first text string.\nText2 is the second text string.\n\nExample:\n   EXACT(\"Spreadsheet\",\"Spreadsheet\") = TRUE\n   EXACT(\"Spreadsheet\",\"S preadsheet\") = FALSE\n   EXACT(\"Spreadsheet\",\"spreadsheet\") = FALSE";
  }
}